#pragma once

namespace WCMM{

class CHandle
{

public:
	CHandle() throw();

	CHandle(_Inout_ CHandle& h) throw();

	explicit CHandle(_In_ HANDLE h) throw();

	~CHandle() throw();

	CHandle& operator=(_Inout_ CHandle& h) throw();

	operator HANDLE() const throw();

	//
	// Attach to an existing handle (takes ownership).
	//

	void Attach(_In_ HANDLE h) throw();

	//
	// Detach the handle from the object (releases ownership).
	//

	HANDLE Detach() throw();

	//
	// Close the handle.
	//

	virtual void Close() throw();

public:
	HANDLE m_h;

};

}

